/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gestionseguridadadministrativa.tareasprogramadas;

import org.quartz.Trigger;
import org.quartz.TriggerUtils;

/**
 *
 * @author Renato
 */
public class TemporizadorTareas {
    private static org.quartz.Scheduler scheduler;
     public static void iniciar() throws org.quartz.SchedulerException {
         try {
             org.quartz.JobDetail    jobDetailDesusoSistema = new org.quartz.JobDetail("VerificaDesuso", org.quartz.Scheduler.DEFAULT_GROUP, VerificaDesusoSistema.class);
             Trigger trigger = TriggerUtils.makeMinutelyTrigger(50);
             org.quartz.JobDetail    jobDetailDesusoTarea = new org.quartz.JobDetail("Tarea", org.quartz.Scheduler.DEFAULT_GROUP, VerificaAlertas.class);
             Trigger trigger2 = TriggerUtils.makeMinutelyTrigger(10);

             trigger.setName("trigger1");
             trigger.setGroup("group1");
             trigger2.setName("trigger2");
             trigger2.setGroup("group1");

             scheduler = org.quartz.impl.StdSchedulerFactory.getDefaultScheduler();
             scheduler.scheduleJob(jobDetailDesusoSistema, trigger);
             scheduler.scheduleJob(jobDetailDesusoTarea,trigger2);
             scheduler.start();
         } catch (Exception e) {
             e.printStackTrace();
         }
     }

      public static void stop(){
         try {
             scheduler.shutdown();
         } catch (Exception ex) {
             ex.printStackTrace();
         }
     }
}
